﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DataPlayer
{
    static DataPlayer()
    {
        Instance = new DataPlayer();
        Instance._groupId = "";
    }
    public static DataPlayer Instance;
    public string userId;

    public string cacheUser;
    public string cachePsw;

    //时候登录过
    public bool IsLogined
    {
        get
        {
            return !string.IsNullOrEmpty(cacheUser);
        }
    }

    private string _groupId;
    public void SetGroupId(string groupId)
    {
        _groupId = groupId;
        PlayerPrefs.SetString(nameof(_groupId), _groupId);
    }

    public string GetGroupId()
    {
        return _groupId;
    }

    public void ClearGroupId()
    {
        PlayerPrefs.DeleteKey(nameof(_groupId));
        _groupId = "";
    }

    public string GetStoreGroupId()
    {
        return PlayerPrefs.GetString(nameof(_groupId), "");
    }
}
